<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function showAddress(zipcode,sido,gugun,dong,seq){
	opener.document.form.zipcode.value=zipcode;
	opener.document.form.sido.value=sido;
	opener.document.form.gugun.value=gugun;
	opener.document.form.dong.value=dong;
	opener.document.form.seq.value=seq;
	window.close();	
}
function searchAddress(){
	var form = document.form1;
	form.action = "searchAddress.do";
	form.method = "post";
	form.submit();	
}
</script>
</head>
<body>
동으로 검색해주세요<br>
<form name="form1">
<input type="text" name="dong"><input type="submit" value="주소찾기" onClick="searchAddress()"><br>
</form>

<c:forEach items="${requestScope.list }" var="adto">
<a href="javascript:showAddress('${adto.zipcode}','${adto.sido}','${adto.gugun}','${adto.dong }','${adto.seq }')">
우편번호 : ${adto.zipcode}<br>
시도 : ${adto.sido}<br>
군 : ${adto.gugun}<br>
동 : ${adto.dong }<br>
</a>
<hr>
</c:forEach>
</body>
</html>